package com.esa.servlet.user;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.esa.dbi.impl.CourseDBImpl;
import com.esa.dbi.impl.StudentDBImpl;

public class DeleteStudentServlet extends HttpServlet {
	public void doGet(HttpServletRequest request,HttpServletResponse response)
	throws ServletException,IOException{
		response.setContentType("text/html");
		PrintWriter out=response.getWriter();
		this.doPost(request, response);
		out.flush();
		out.close();
	}
	
	public void doPost(HttpServletRequest request,HttpServletResponse response)
	throws ServletException,IOException{
		response.setContentType("text/html");
		PrintWriter out=response.getWriter();
		
		String sno=request.getParameter("sno");
		StudentDBImpl sdbi=new StudentDBImpl();
	    sdbi.deleteStudent(sno);
		response.sendRedirect("ShowAllStudentsServlet");
	//System.out.println("DeleteUserServlet line 30....");

		out.flush();
		out.close();
	}
}
